Repository navigation
[fix] models: say why the catalog request failed, not just which status - #499
Zhangbo-cn wants to merge 13 commits into
Conversation
Pointing the picker at https://api.minimax.cn/v1 with a key, then pressing Fetch models, reported "无法读取模型的声明(HTTP 401)" and stopped. Nothing on screen said whether the key was rejected, the address was wrong, or the endpoint simply did not exist there — a 401, a 404 and a 405 all read the same, and all of them look like a fact about the model rather than about the request. The receipt now carries the status, the address that was actually queried, and the likely cause: an invalid or expired key, a key not allowed for that address, a missing /models endpoint (usually a Base URL without /v1), a wrong method, rate limiting, or a service-side failure. Errors that are not about the text model keep their existing behaviour, and the message still ends with the fact that nothing was changed. This is an error message, not a probe: it names what the status usually means without claiming the key was tested, which only the Test button does.
de73f1f to
0afcafb
Compare
… which passes twice on the same tree locally and had passed on this branch before
|
PASS d320c6b
Nit: the English text is reconstructed by regex over the Chinese receipt ( Ran: |
capability discovery / the real-OpenCode worker timed out under load; both pass locally on this tree.
Co-Authored-By: Claude Code <noreply@anthropic.com>
…-hints Co-Authored-By: Claude Code <noreply@anthropic.com>
… merged head Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
Media services now localize the same 401/403/404/405/429/5xx receipt as text services instead of falling back to the generic message.
# Conflicts: # scripts/ci/python_shards.json
# Conflicts: # tests/test_localization.py
|
Conflicts with Internal audit score: 85/100. @david6666666 could you take another look and give your review decision when you have a moment? |
david6666666
left a comment
There was a problem hiding this comment.
PASS 20ca755 No linked issue
LGTM。下载核对了四张中英文 401 前后截图,现在能看出实际查询的接口和最可能的原因。当前版也给四种 model kind 统一了 error code;503 路径有 browser assertion。英语从中文文本提取 URL 的做法对少见路径仍有限制(PR 已注明),不阻塞这个修复。证据来自隔离 fixture,不是 MiniMax 线上鉴权。
Ran: 回读同 SHA Release及本 PR 的变更与证据。Not run: 未独立执行 PR 代码或调用真实 provider。
92/100(范围/正确性/验证/主张证据/简洁度:3/2/3/3/3)。
Base ec39d09e3dd990dd9df2f21f2be4d06024d78cf4 · Head 20ca7558fc5900614b89fb26a7f09114abde3a1f。
Dot acting for @david6666666 under delegated independent OpenDirector PR review.
Coordinator: 由仓库确认的集成人处理合入;此评审未合并。
What
Configuring MiniMax at
https://api.minimax.cn/v1with a key, then pressing Fetch models, reported:Three problems in one line. It says nothing about the request that failed, nothing about which address was queried, and it reads as if the models failed a check while the key — the thing that was actually rejected — is never named. A 401, a 404 and a 405 all produced the same sentence, so the user had to guess between a wrong key, a wrong Base URL, and an endpoint that does not exist.
The receipt now names the status, the URL that was queried, and the likely cause:
/modelsendpoint — check the Base URL, which usually ends with/v1GET /modelsWording is deliberate: the hint says what the status usually means and never claims the key was tested — only the Test button sends a request that does that. Errors that are not about a text model keep their existing
code, so nothing that was previously untranslated becomes translated.Changes
packages/core/src/opendirector/integrations/model_capabilities.py: a non-200/modelsresponse names the status, the queried/modelsaddress and the likely cause. The code staysmodel_list_http_errorfor a text model.apps/api/src/opendirector_api/localization.py:model_list_messagebuilds the English receipt from the Chinese one, keeping the status and queried URL. It returnsNonewhen the Chinese text carries no status, so an unexpected shape keeps the previous message instead of inventing a hint.tests/test_localization.py,tests/test_model_configs.py: the non-200 receipt keeps status, URL and cause in both languages.tests/browser/zhipu_provider.mjs: the forced-503 assertion now expects the new wording.No new user-facing copy is hardcoded in the frontend; both
zh-CNanden-USreceipts come from the backend.Evidence
Isolated fixture API and Vite; no real projects, models, or paid calls. The Zhipu preset is used because the existing browser fixture supplies its catalog. The fixture rewrites the provider origin to a loopback catalog, so the receipt prints the loopback address the backend actually queried; the Base URL field still shows
https://open.bigmodel.cn/api/paas/v4. That is the real behaviour — the receipt names the URL that was queried, not the one typed into the form.Reproduction: open Settings → Model connections → Add service → Zhipu BigModel, enter a key, press Fetch models with the catalog answering 401.
Before (
728b4077, current main): the receipt names neither the URL nor the cause.After (
815169d4, feature head): the receipt carries the status, the queried URL and the likely cause in both languages.Failing before, passing after: the new tests were copied onto
728b4077and run there:On the head the same two files pass (46 passed).
Ran
On the head (
815169d447daa264d6be4330066e35d01e2d4193):PYTHONPATH=packages/core/src:apps/api/src python3 -m pytest tests/test_localization.py tests/test_model_configs.py -q— 46 passednode tests/browser/zhipu_provider.mjsagainst an isolated fixture API and Vite at this head — passed, including the new 503 wording in both languages728b4077— 2 failed (above)728b4077(screenshots above)Not run
Checks note
The previous Release run on the pre-merge head (
fd8e96a0) failed two lanes for reasons outside this diff:checks / pythonfailed at the setup oftests/test_agent_visual_gate.py::test_real_opencode_native_visual_input[image-model]withAssertionError: Real OpenCode integration timed out(tests/test_native_runtime.py:370), a real-OpenCode integration timeout unrelated to an error-copy change. The suite itself reported3330 passed, 121 skipped.checks / browser (isolated)ran all33/33 browser workflowssuccessfully (33/33 browser workflows passed in 382.3s) but the job reached its 30-minute limit during the run and was cancelled.The branch now carries current
main(728b4077) and a fresh run starts on the pushed head; no code change addresses those two environmental failures.The run on this head (
815169d4, run 47322378391) completedsuccess:checks / static,checks / python,checks / frontend,checks / browser (isolated),checks / browser (voice),checks / browser (assistant),checks / desktop / macos,checks / desktop / windows, and the aggregatechecks / checksall passed.Merge
origin/mainthroughec39d09eis merged into the branch. The only conflict wastests/test_localization.py: this PR's model-list case and the Seed Audio cases from#661were both kept.apps/api/src/opendirector_api/localization.pyauto-merged with both sets of mappings. The current tip is20ca7558(an empty commit reruns the media lane after a headless-ChromeDevTools URLenvironment flake); Release checks are green on it (run 47530982141), including the rerunchecks / python (media).Review
728b40774628307f315a2b29c466237a8c434a11(origin/main)815169d447daa264d6be4330066e35d01e2d4193opendirector-review, candidate mode): 93/100. Ratings: scope 3/3, correctness 3/3, validation 2/3 (Release checks unsettled; focused tests and the Zhipu browser test ran), claim evidence 3/3 (before/after captures in both languages at the pinned base and head, plus the failing-before run), simplicity 3/3 (no added comments; the English receipt reuses the existing localization boundary). Verdict: WITHHOLD only because Release checks have not run on the unpushed head; no blocking code finding.model_list_messageappends "Nothing was changed." even if a future Chinese producer omits that clause; the URL is taken up to the first closing parenthesis, so a URL containing)would be truncated.46 passedon the head,2 failed, 44 passedon the base with the same two assertions, the Zhipu browser test,check:i18n, andcheck:browser-locale, inspected the four screenshots and uploaded copies (HTTP 200), and checked the merge against728b4077withgit merge-tree.video/image/audio) the new Chinese receipt is detailed but theen-USfallback stays generic, because the code remainsinvalid_inputthere; this asymmetry is pre-existing on the English side and outside the text-model scope stated above. The browser assertion was narrowed to the prefix读取模型列表失败(HTTP 503/Could not load the model list (HTTP 503, so the URL and cause are asserted by the Python tests, not the browser test.815169d4completedsuccessacross all nine jobs, which satisfies the condition both reviews withheld on; their scores and findings above are unchanged.npm run build, and the browser lanes were not run locally; Release checks on this head are green.Review round 2
read_service_modelsnow raisesmodel_list_http_errorfor every kind, so image, video, and audio services receive the same English receipt as text services.test_every_model_kind_keeps_the_model_list_failure_codecovers all four kinds, asserting the Chinese receipt is unchanged and that the en-US receipt keeps the HTTP status, the queried URL, and the cause.pytest tests/test_localization.py tests/test_model_configs.py— 51 passed.main(8cdf67ec) omitstests/test_ark_availability.py,tests/test_wait_outcome.py, andtests/test_trace_job_queries.pyfromscripts/ci/python_shards.json, sochecks / python (core)fails onmainand on every PR. This tip lists the three modules;pytest tests/test_ci_layers.py— 21 passed.2b007b0e(currentmainmerged); Release checks on this exact SHA are pending.🤖 Generated with Claude Code